package com.work.demo.dao;
import com.work.demo.dao.impl.ProductDaoImpl;
import com.work.demo.entity.Product;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Repository;


@Repository
public class ProductDao implements ProductDaoImpl {

    @Autowired(required = false)
    private JdbcTemplate template;

    @Override
    public int insert(Product product) {
        return template.update("insert into product values (null, ?, ?, ?, ?, ?, ?, ?)"
                ,product.getPid(),product.getName(),product.getClassify(), product.getImg(),
                product.getDescription(), product.getInstruction(), product.getPrice());
    }
}
